<template>
  <div class="bulk-trade">
    <div class="bulk-trade-title">
      <p class="bulk-trade-title-text">大宗贸易商城</p>
    </div>
    <div class="bulk-trade-main">
      <div class="bulk-trade-item">
        <img src="@/assets/bigscreen2/大宗累计交易额(元).png" alt="" />
        <div class="item-right">
          <count-to
            class="right-number"
            :startVal="0"
            :endVal="totalAmount"
            :duration="1000"
            :decimals="2"
          ></count-to>
          <p class="right-text">累计交易额(元)</p>
        </div>
      </div>
      <div class="bulk-trade-item">
        <img src="@/assets/bigscreen2/大宗累计交易额(元).png" alt="" />
        <div class="item-right">
          <count-to
            class="right-number"
            :startVal="0"
            :endVal="totalCount"
            :duration="1000"
          ></count-to>
          <p class="right-text">累计交易笔数(笔)</p>
        </div>
      </div>
      <div class="bulk-trade-item">
        <img src="@/assets/bigscreen2/大宗上架商品数(个).png" alt="" />
        <div class="item-right">
          <count-to
            class="right-number"
            :startVal="0"
            :endVal="productCount"
            :duration="1000"
          ></count-to>
          <p class="right-text">上架商品数(个)</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import CountTo from "@/components/vueCountTo/vue-countTo.vue";
import { ajax } from "@/store/service";

const totalAmount = ref(0);
const totalCount = ref(0);
const productCount = ref(0);

const getTradingMall = async () => {
  const [res] = await ajax.tradingMallAll();
  console.log('res',res);
  totalAmount.value=res.totalAmount
  totalCount.value=res.totalCount
  productCount.value=res.productCount
};

onMounted(() => {
  getTradingMall();
});

</script>

<style scoped lang='scss'>
.bulk-trade {
  margin-top: 32px;
  .bulk-trade-title {
    width: 842px;
    height: 68px;
    background-image: url("@/assets/bigscreen2/商城小标题.svg");
    padding-top: 30px;
    box-sizing: border-box;
    .bulk-trade-title-text {
      font-weight: 640;
      margin-left: 37px;
      width: 132px;
      height: 22px;
      font-size: 22px;
      font-family: JLinXin;
      font-weight: 600;
      line-height: 22px;
      background: #fffde8 linear-gradient(180deg, #e8feff 40%, #00a9ff 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
  }
  .bulk-trade-main {
    margin-top: 14px;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    .bulk-trade-item {
      height: 60px;
      color: #fff;
      display: flex;
      align-items: center;
      .item-right {
        margin-left: 12px;
        .right-text {
          font-size: 16px;
          font-family: SourceHanSansCN-Medium, SourceHanSansCN;
          font-weight: 500;
          color: #ffffff;
          line-height: 24px;
          opacity: 0.8;
        }
        .right-number {
          font-size: 24px;
          font-family: D-DIN-PRO-Heavy, D-DIN-PRO;
          font-weight: 800;
          color: #ffffff;
          line-height: 24px;
          letter-spacing: 1px;
          margin-bottom: 8px;
        }
      }
    }
  }
}
</style>